using System.Linq;
using ilgolosone.Shared.Data;
using ilgolosone.Shared.Domain;

namespace ilgolosone.DomainModel.Repositories
{
    public static class RepositoryExtensions
    {
        public static IQueryable<TEntity> Filter<TEntity>(this IRepository<TEntity> repository, IDomainQuery<TEntity> specification) where TEntity : IAggregateRoot 
        {
            return repository.Where(specification.Criteria);
        }
    }
}